//
//  CAGradientLayerViewController.m
//  20170207
//
//  Created by xuPeng on 2017/9/18.
//  Copyright © 2017年 一直丶黑曼巴. All rights reserved.
//

#import "CAGradientLayerViewController.h"

@interface CAGradientLayerViewController ()

@end

@implementation CAGradientLayerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    /*
     一般用于在其背景色上绘制一个颜色渐变，以填充整个形状。
     */

    CAGradientLayer *layer = [CAGradientLayer layer];
    layer.startPoint = (CGPoint){0.5f, 0.0f};
    layer.endPoint = (CGPoint){0.5f, 1.0f};
    layer.colors = [NSArray arrayWithObjects:(id)[UIColor blueColor].CGColor, (id)[UIColor redColor].CGColor, (id)[UIColor greenColor].CGColor, nil];
    layer.locations = @[@0.0f, @0.6f, @1.0f];
    layer.frame = self.view.layer.bounds;
    [self.view.layer insertSublayer:layer atIndex:0];
}
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
//    [self.navigationController setNavigationBarHidden:YES animated:animated]; // 隐藏导航栏
}


@end
